<?php include DIR_MODULES . 'menu/menu_main_ctg_corporate.php'; ?>

<table cellpadding="0" cellspacing="0" width="960px" border="0" align="center">
    <tr>
        <td id="coloana_dreapta_root_corp" valign="top">
        <!-- mijloc si dreapta //////////////////////////////////// -->
            <table cellpadding="0" cellspacing="0" width="100%" border="0">
                <tr>
                    <td id="content_corp" valign="top">
                    <!-- galerie media //////////////////////////////////////// -->
                    <?php include DIR_MODULES . 'galerie_header/index.php';?>
                    <!-- end galerie media //////////////////////////////////// -->
                            <div class="mijloc_hr">&nbsp;</div>
                    <!-- articole mijloc /////////////////////////////////////// -->
                            <div class="mijloc_root">
                                    <table  cellpadding="0" cellspacing="0" width="100%" border="0">
                                    <?php
                                        $data = mysql_query("select * from dt_offers where c_id = '".$_GET['id']."' and show_in_head = '0' order by o_id desc limit 0,4");
                                        while ($row = mysql_fetch_array($data)){
                                            $imgs = $offersClass->picViewForOffer($row['o_id']);
                                            $img = mysql_fetch_array($imgs);
                                            $photos = mysql_query("select * from dt_offers_photos where o_id = '".$row['o_id']."'");
                                            $photoRow = mysql_fetch_array($photos);

                                            echo '<tr>';
                                            if ($photoRow['oImg_file'] == '')
                                                echo '<td class="articol_corp_modul" valign="top" colspan="2">';
                                            else
                                                echo '<td class="articol_corp_modul" valign="top">';

                                            echo '<div class="articol_corp_titlu"><a class="link_vaca" href="../../offers/'.$row['c_id'].'/'.$row['o_id'].'/'.cleanitup($row['o_title']).'.html">'.$row['o_title'].'</a> <b><a class="link_titlu_corporate_edit" href="../../offers/'.$row['c_id'].'/'.$row['o_id'].'/'.cleanitup($row['o_title']).'.html">'.$row['o_label'].'</a></b></div>';
                                            echo '<div class="articol_corp_text">';
                                            echo '<a class="link_vaca" href="../../offers/'.$row['c_id'].'/'.$row['o_id'].'/'.cleanitup($row['o_title']).'.html">'.limitclear($row['o_small_desc'], 335).'...</a>';
                                            echo '</div>';
                                            echo '<div class="articol_corp_more"><a href="../../offers/'.$row['c_id'].'/'.$row['o_id'].'/'.cleanitup($row['o_title']).'.html">Mai mult</a>&nbsp;<img src="../../templates/default/images/more.png" width="9" height="9"></div>';
                                            echo '</td>';

                                            if ($photoRow['oImg_file'] != ''){
                                                echo '<td class="articol_corp_pic" valign="bottom">';
                                                echo '<img src="../../uploads/offers/img/'.cleanitup($row['o_title']).'/thumbs/thumb_'.$img['oImg_file'].'" width="160" height="115">';
                                                echo '</td>';
                                            }
                                            echo '</tr><tr><td colspan="2"><div class="mijloc_hr">&nbsp;</div></td></tr>';
                                        }
                                    ?>
                                    </table>
                                    <div id="content_container" style="background-color:lime">
                                    <?php 
                                    	$t = 0;
                                    	$testQ = mysql_query("select * from dt_offers where c_id = '".$_GET['id']."' and show_in_head = '0' order by o_id desc limit 4,6");
                                    	while ($testrow = mysql_fetch_array($testQ)) {
                                    		if ($t % 2) {
                                    			echo '<div id="container_unu" style="background-color:white;width:300px;float:right;padding:5px;">';
                                    			echo '<div class="articol_corp_titlu"><a class="link_vaca" href="../../offers/'.$testrow['c_id'].'/'.$testrow['o_id'].'/'.cleanitup($testrow['o_title']).'.html">'.$testrow['o_title'].'</a><b> <a class="link_titlu_corporate_edit" href="../../offers/'.$testrow['c_id'].'/'.$testrow['o_id'].'/'.cleanitup($testrow['o_title']).'.html">'.$testrow['o_label'].'</a></b></div>';
                                                echo '<table cellpadding="0" cellspacing="0" width="100%" border="0">';
                                                echo '<tr>';
                                                echo '<td class="articol_corp_modul" valign="top">';
                                                echo '<div class="articol_corp_text">';
                                                echo '<a class="link_vaca" href="../../offers/'.$testrow['c_id'].'/'.$testrow['o_id'].'/'.cleanitup($testrow['o_title']).'.html">'.limitclear($testrow['o_small_desc'], 160).'...</a>';
                                                echo '</div>';
                                                echo '</td>';

                                                $imgs = $offersClass->picViewForOffer($testrow['o_id']);
                                                $img = mysql_fetch_array($imgs);
                                                $photos = mysql_query("select * from dt_offers_photos where o_id = '".$testrow['o_id']."'");
                                                $photoRow = mysql_fetch_array($photos);

                                                if ($photoRow['oImg_file'] != ''){
                                                    echo '<td class="articol_corp_pic" valign="bottom">';
                                                    echo '<img src="../../uploads/offers/img/'.cleanitup($testrow['o_title']).'/thumbs/thumb_'.$img['oImg_file'].'" width="130" height="90">';
                                                	echo '</td>';
                                                }

                                                echo '</tr>';
                                                echo '</table>';
                                                //echo '<div class="articol_corp_more"><a href="../../offers/'.$row['c_id'].'/'.$row['o_id'].'/'.cleanitup($row['o_title']).'.html">Mai mult</a>&nbsp;<img src="../../templates/default/images/more.png" width="9" height="9"></div>';
                                                echo '<br/>';
												echo '<div class="mijloc_hr">&nbsp;</div>';
                                    			echo '</div>';
                                    		}
                                    		else { 
                                    			echo '<div id="container_doi" style="background-color:#F2F2F2;width:300px;float:left;padding:5px;">';
                                    			echo '<div class="articol_corp_titlu"><a class="link_vaca" href="../../offers/'.$testrow['c_id'].'/'.$testrow['o_id'].'/'.cleanitup($testrow['o_title']).'.html">'.$testrow['o_title'].'</a><b><a class="link_titlu_corporate_edit" href="../../offers/'.$testrow['c_id'].'/'.$testrow['o_id'].'/'.cleanitup($testrow['o_title']).'.html">'.$testrow['o_label'].'</a></b></div>';
                                                echo '<table cellpadding="0" cellspacing="0" width="100%" border="0">';
                                                echo '<tr>';
                                                echo '<td class="articol_corp_modul" valign="top">';
                                                echo '<div class="articol_corp_text">';
                                                echo '<a class="link_vaca" href="../../offers/'.$testrow['c_id'].'/'.$testrow['o_id'].'/'.cleanitup($testrow['o_title']).'.html">'.limitclear($testrow['o_small_desc'], 160).'...</a>';
                                                echo '</div>';
                                                echo '</td>';

                                                $imgs = $offersClass->picViewForOffer($testrow['o_id']);
                                                $img = mysql_fetch_array($imgs);
                                                $photos = mysql_query("select * from dt_offers_photos where o_id = '".$testrow['o_id']."'");
                                                $photoRow = mysql_fetch_array($photos);

                                                if ($photoRow['oImg_file'] != ''){
                                                    echo '<td class="articol_corp_pic" valign="bottom">';
                                                    echo '<img src="../../uploads/offers/img/'.cleanitup($testrow['o_title']).'/thumbs/thumb_'.$img['oImg_file'].'" width="130" height="90">';
                                                	echo '</td>';
                                                }

                                                echo '</tr>';
                                                echo '</table>';
                                                //echo '<div class="articol_corp_more"><a href="../../offers/'.$row['c_id'].'/'.$row['o_id'].'/'.cleanitup($row['o_title']).'.html">Mai mult</a>&nbsp;<img src="../../templates/default/images/more.png" width="9" height="9"></div>';
												echo '<div class="mijloc_hr">&nbsp;</div>';
                                    			echo '</div>';
                                    		}                                    		
                                    		$t++;
                                    	}
                                    ?>
                                    </div>
                            </div>
                    <!-- end articole mijloc /////////////////////////////////// -->
                    </td>
                    <td class="coloana_separator" valign="top">&nbsp;</td><?php
                            $cDreapta = mysql_query("select * from dt_mod_visible
                                            where z_id = '2'
                                            and visible = '1'
                                            and c_id = '2'
                                            order by `order`");
                            //daca nu exista nici un rezultat atunci ascunde coloana
                            if (mysql_num_rows($cDreapta)>0){
                    ?>
                    <td id="content_dreapta" valign="top">
                    <!-- content dreapta ////////////////////////////////////// -->
                    <?php include DIR_MODULES . 'coloane_module/coloana_dreapta.php'; ?>
                    <!-- end content dreapta ////////////////////////////////// -->
                    </td>
                    <?php }?>
                </tr>
            </table>
    <!-- end mijloc si dreapta //////////////////////////////// -->
        </td>
    </tr>
</table>
